package com.zsy.springframework.beans.factory.beanfactory;

import com.zsy.springframework.beans.factory.jiekou.SingletonBeanRegistry;

import java.util.HashMap;
import java.util.Map;

//这个知识为了注册单例的信息到map当中，知识中间环节，并不算是一个beanfactory
public class DefaultSingletonBeanRegistry implements SingletonBeanRegistry {

    private final Map<String, Object> singletonObjects = new HashMap<>();


    @Override
    public Object getSingleton(String beanName) {
        return singletonObjects.get(beanName);
    }

    public void addSingleton(String beanName, Object singletonObject) {
        singletonObjects.put(beanName, singletonObject);
    }
}
